﻿var CONTROL_PREFIX = "ctl00_ContentPlaceHolder1_ucGrantDetailView_";

function CopyApplicantAddressToClipboard() {
    var address1 = document.getElementById(CONTROL_PREFIX + "lblApplicantStreetAddress1").innerText;
    var address2 = document.getElementById(CONTROL_PREFIX + "lblApplicantStreetAddress2").innerText;
    var city = document.getElementById(CONTROL_PREFIX + "lblCity").innerText;
    var state = document.getElementById(CONTROL_PREFIX + "lblState").innerText;
    var postalCode = document.getElementById(CONTROL_PREFIX + "lblPostalCode").innerText;
    var address = address1 + " " + address2 + "," + city + " " + state + " " + postalCode;
    CopyToClipboard( FormatAddress( address1, address2, city, state, postalCode ) );
}

function CopyCustodianAddressToClipboard() {
    var address1 = document.getElementById(CONTROL_PREFIX + "lblCustodianStreetAddress1" ).innerText;
    var address2 = document.getElementById(CONTROL_PREFIX + "lblCustodianStreetAddress2" ).innerText;
    var city = document.getElementById(CONTROL_PREFIX + "lblCustodianCity" ).innerText;
    var state = document.getElementById(CONTROL_PREFIX + "lblCustodianState" ).innerText;
    var postalCode = document.getElementById(CONTROL_PREFIX + "lblCustodianPostalCode" ).innerText;
    CopyToClipboard( FormatAddress( address1, address2, city, state, postalCode ) );
}

function FormatAddress( address1, address2, city, state, postalCode ) {
    return address1 + " " + address2 + "," + city + " " + state + " " + postalCode;
}